import { Body, Controller, Get, Put, UseGuards } from '@nestjs/common';
import { UserService } from './user.service';
import { GetUserInfo } from 'src/dec/cu-dec/cu-dec.decorator';
import { AuthGuard } from 'src/gurad/auth/auth.guard';
import { UpdateUserDto } from './dto/update-user.dto';

@UseGuards(AuthGuard)
@Controller('user')
export class UserController {
  constructor(private readonly userService: UserService) {}

  @Get()
  findOne(@GetUserInfo('id') id: number) {
    return this.userService.findOne(+id);
  }

  @Put()
  update(@GetUserInfo('id') id: number, @Body() data: UpdateUserDto) {
    return this.userService.update(+id, data);
  }
}
